﻿using Kingdee.BOS;
using Kingdee.BOS.Contracts;
using Kingdee.BOS.Core;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace WSDZ.KM.ZH.XiaoManIntegrating40
{
    /*
    WSDZ.KM.ZH.XiaoManIntegrating40.XiaoManCustomerJob,WSDZ.KM.ZH.XiaoManIntegrating40
    */
    [Description("Erp获取小满客户"), HotUpdate]
    public class XiaoManCustomerJob : IScheduleService
    {
        public void Run(Context ctx, Schedule schedule)
        {
          
            try
            {
                //date1; date2  参数 时间1;时间2
                string beginDate = DateTime.Now.AddDays(-3).ToString("yyyy-MM-dd 00:00:00");
                string endDate = DateTime.Now.ToString("yyyy-MM-dd 23:59:59");
                string xiaomanId = string.Empty;
                string paraStr = schedule.Parameters.Trim();
                if (!paraStr.IsNullOrEmptyOrWhiteSpace())
                {
                    if (paraStr.Contains(";"))
                    {
                        List<string> paraList = paraStr.Split(';').ToList();
                        beginDate = paraList[0];
                        if (paraList.Count>1)
                            endDate = paraList[1];
                        if (paraList.Count>2)
                            xiaomanId = paraList[2];
                    }
                }
                new XiaoManCustomerManager().Main(ctx, beginDate, endDate, xiaomanId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
           
        }
    }
}
